import React, { Component } from 'react'

export class App extends Component {
  state = {
    count:0
  }
  // 挂载前的生命周期钩子
  componentDidMount(){
    document.title = `点击了${this.state.count}次`
  }
  componentDidUpdate(){
    document.title = `点击了${this.state.count}次`
  }
  render() {
    return (
      <div>
        <p>您点击了：{this.state.count}次</p>
        <button onClick={()=>this.setState({count:this.state.count+1})}>点击</button>
      </div>
    )
  }
}

export default App